﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace PMS.AuditClass
{
    public class TuiFei_Audit
    {
        //退费审核后
        public static void RemoveStuClass(BD_ReviewTotal total, List<BD_ReviewDetail> detail)
        {
            View_Audit_Tuifei VAT = BLLSession.Current.View_Audit_TuifeiBLL.GetListBy(p => p.ReviewId == total.ID).FirstOrDefault();
            string[] strArray = VAT.bmId.Split('，');
            int bmId = 0;
            for (int i = 0; i < strArray.Length; i++)
            {
                if (strArray[i] != "")
                {
                    bmId = Convert.ToInt32(strArray[i]);
                    BM_StudentBmInfo bm = DALSession.Current.BM_StudentBmInfoDAL.GetListBy(p => p.ID == bmId).FirstOrDefault();
                    bm.ifTuiban = "1";
                    BLLSession.Current.BM_StudentBmInfoBLL.ModifyBy(bm, t => t.ID == bmId, "ifTuiban");
                    if(VAT.tuifeiType=="1"){
                        BM_StudentJifen stuJF = DALSession.Current.BM_StudentJifenDAL.GetListBy(p => p.stuId == VAT.stuId).FirstOrDefault();
                        int jifen = Commons.String2Int32(VAT.costJine) / 10;
                        stuJF.stuJifen = (Convert.ToInt32(stuJF.stuJifen) - jifen).ToString();
                        stuJF.fillDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        BLLSession.Current.BM_StudentJifenBLL.ModifyBy(stuJF, t => t.ID == stuJF.ID, "stuJifen", "fillDate");
                       
                    }
                }
            }
        }
    }
}